<?php
	require 'sessionInfo.class.php' ;
	SessionInfo::checkAdminLogin();
	require 'sql.class.php' ;

?>
<!DOCTYPE html>
<html>
<head>
	<title></title>
	<link rel="stylesheet" type="text/css" href="/mcnews/css/admin.css">
</head>

</div>

<div class="menu">
	<ul>
		<li style="background-color: white;"><a href="member.php">用户管理</a></li>
		<li><a href="class.php">文章分类</a></li>
		<li><a href="content.php">文章管理</a></li>
		<li><a href="loginout.php">退出</a></li>
	</ul>
</div>

<div class="rightContent" id="rightContent">
	<div class="addMember">添加数据
		<form action="memberaction.php?type=0" method="POST" enctype="multipart/form-data">
			用户名:<input type="text" name="username">
			昵称:<input type="text" name="nickname">
			密码:<input type="text" name="password">
			头像:<input type="file" name="avatar">
			性别:<input type="text" name="gender">
			手机:<input type="text" name="mobile">
			<br/>
			<input type="submit" name="" value="添加">
		</form>
	</div>

	<br/>
	<div class="memberList">查看数据
		<ul>
		<li style="clear: both; overflow: hidden;">
			<span class="memberLabel"></span>
			<span class="memberLabel"></span>
			<span class="memberLabel">id</span>
			<span class="memberLabel">username</span>
			<span class="memberLabel">nickname</span>
			<span class="memberLabel">password</span>
			<span class="memberLabel">avatar</span>
			<span class="memberLabel">gender</span>
			<span class="memberLabel">mobile</span>
		</li>
		<?php
			$arr = getMemberInfo();
			$h = "";
			foreach ($arr as $key => $dic) {
				$id = $dic["id"];
				$username = $dic["username"];
				$nickname = $dic["nickname"];
				$password = $dic["password"];
				$avatar = $dic["avatar"];
				$gender = $dic["gender"];
				$mobile = $dic["mobile"];

				$par = "?id=" . $id . "&username=" . $username . "&nickname=" . $nickname . "&password=" . $password . "&avatar=" . $avatar . "&gender=" . $gender . "&mobile=" . $mobile . "";

				$style = "memberLabelLightGray";
				if ($key % 2 == 0) {
					$style = "memberLabelDarkGray";
				} 
				$h .= "
					<li style='clear: both; overflow: hidden;''>
						<span class='".$style."'><a href='edit.php". $par ."'>修改</a></span>
						<span class='".$style."'><a href='del.php?id=". $id ."'>删除</a></span>
						<span class='".$style."'>" . $id . "</span>
						<span class='".$style."'>" . $username . "</span>
						<span class='".$style."'>" . $nickname . "</span>
						<span class='".$style."'>" . $password . "</span>
						<span class='".$style."'>" . $avatar . "</span>
						<span class='".$style."'>" . $gender . "</span>
						<span class='".$style."'>" . $mobile . "</span>
					</li>
				";
			}
			echo $h;
		?>
		</ul>
	</div>
</div>
<script type="text/javascript">
	var windowWidth = document.body.scrollWidth;
	var rightContent = windowWidth - 170 ;
	var windowHeight = document.body.clientHeight;
	document.getElementById("rightContent").style.width=rightContent + "px";
	document.getElementById("rightContent").style.height=windowHeight + "px";

	window.onresize=function(){  
	    var windowWidth = document.body.scrollWidth;
		var rightContent = windowWidth - 170 ;
		var windowHeight = document.body.clientHeight;

		document.getElementById("rightContent").style.width=rightContent + "px";
		document.getElementById("rightContent").style.height=windowHeight + "px";
    }  


</script>

</body>
</html>